package club.banyuan.demo.demo7;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @author edz
 * @version 1.0
 * @date 2020/12/22 下午4:49
 */
public class ReflectDemo0 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        //获取Class对象
        Class<?> c = Class.forName("club.banyuan.demo.demo7.Student");

        //获取单个公共构造方法
        Constructor<?> con = c.getConstructor(String.class, int.class, String.class);


        Object obj = con.newInstance("张凯琦",26,"男");
        System.out.println(obj);


    }
}
